home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / smartctl < prev    next >
Encoding:
Text File  |  2010-11-16  |  3.4 KB  |  147 lines

  1. # bash completion for smartctl(8)
  2.  
  3. have smartctl &&
  4. {
  5. _smartctl_quietmode()
  6. {
  7.     COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
  8. }
  9. _smartctl_device()
  10. {
  11.     local i opts='ata scsi sat marvell hpt cciss'
  12.     for (( i=0; i <= 31; i++ )) ; do
  13.         opts="$opts 3ware,$i"
  14.     done
  15.     COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
  16. }
  17. _smartctl_tolerance()
  18. {
  19.     COMPREPLY=( $( compgen -W 'normal conservative permissive \
  20.         verypermissive' -- "$cur" ) )
  21. }
  22. _smartctl_badsum()
  23. {
  24.     COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
  25. }
  26. _smartctl_report()
  27. {
  28.     COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
  29. }
  30. _smartctl_powermode()
  31. {
  32.     COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
  33. }
  34. _smartctl_feature()
  35. {
  36.     COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
  37. }
  38. _smartctl_log()
  39. {
  40.     COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
  41. }
  42. _smartctl_vendorattribute()
  43. {
  44.     COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
  45.                 9,temp 192,emergencyretractcyclect 193,loadunload \
  46.                 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
  47.                 200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
  48. }
  49. _smartctl_firmwarebug()
  50. {
  51.     COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
  52.         -- "$cur" ) )
  53. }
  54. _smartctl_presets()
  55. {
  56.     COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
  57. }
  58. _smartctl_test()
  59. {
  60.     COMPREPLY=( $( compgen -W 'offline short long conveyance select \
  61.                 afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
  62. }
  63.  
  64.  
  65. _smartctl()
  66. {
  67.     local cur prev split=false
  68.  
  69.     COMPREPLY=()
  70.     _get_comp_words_by_ref cur prev
  71.  
  72.     _split_longopt && split=true
  73.  
  74.     case $prev in
  75.         -q|--quietmode)
  76.             _smartctl_quietmode
  77.             ;;
  78.         -d|--device)
  79.             _smartctl_device
  80.             return 0
  81.             ;;
  82.         -t|--tolerance)
  83.             _smartctl_tolerance
  84.             return 0
  85.             ;;
  86.         -b|--badsum)
  87.             _smartctl_badsum
  88.             return 0
  89.             ;;
  90.         -r|--report)
  91.             _smartctl_report
  92.             return 0
  93.             ;;
  94.         -n|--nocheck)
  95.             _smartctl_powermode
  96.             return 0
  97.             ;;
  98.         -s|--smart|-o|--offlineauto|-S|--saveauto)
  99.             _smartctl_feature
  100.             return 0
  101.             ;;
  102.         -l|--log)
  103.             _smartctl_log
  104.             return 0
  105.             ;;
  106.         -v|--vendorattribute)
  107.             _smartctl_vendorattribute
  108.             return 0
  109.             ;;
  110.         -F|--firmwarebug)
  111.             _smartctl_firmwarebug
  112.             return 0
  113.             ;;
  114.         -P|--presets)
  115.             _smartctl_presets
  116.             return 0
  117.             ;;
  118.         -t|--test)
  119.             _smartctl_test
  120.             return 0
  121.             ;;
  122.     esac
  123.  
  124.     $split && return 0
  125.  
  126.     if [[ "$cur" == -* ]]; then
  127.         COMPREPLY=( $( compgen -W '--help --version --info --all --quietmode \
  128.             --device --tolerance --badsum --report --nocheck --smart \
  129.             --offlineauto --saveauto --health --capabilities --attributes \
  130.             --log --vendorattribute --firmwarebug --presets --test --captive \
  131.             --abort' -- "$cur" ) )
  132.     else
  133.         cur=${cur:=/dev/}
  134.         _filedir
  135.     fi
  136. }
  137. complete -F _smartctl smartctl
  138. }
  139.  
  140. # Local variables:
  141. # mode: shell-script
  142. # sh-basic-offset: 4
  143. # sh-indent-comment: t
  144. # indent-tabs-mode: nil
  145. # End:
  146. # ex: ts=4 sw=4 et filetype=sh
  147.